package Message;


import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;

import org.simpleframework.xml.Element;
import org.simpleframework.xml.Root;
import org.simpleframework.xml.Serializer;
import org.simpleframework.xml.core.Persister;
@Root
public class Message {
	@Element 
	private String Username;
	@Element
	private String Password;
	
	public enum MessageType {
		register, login;
	}

	public static Message receive(Socket socket) throws Exception {

		Serializer netIn = new Persister();
		InputStream in = socket.getInputStream();
		Message msg = netIn.read(Message.class, in);
		return msg;
	}

	public void send(Socket socket) throws Exception {

		Serializer netOut = new Persister();
		OutputStream out = socket.getOutputStream();
		File f = new File("test.xml");
		netOut.write(out, f);
	}
}
